home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / m2in.lwm < prev    next >
Text File  |  1993-12-13  |  1KB  |  59 lines

  1. /* CMD: Meters<->Inches
  2.  * Convert between metric lengths and feet and inches */
  3. /* By Arnie Cachelin © 1993 NewTek Inc. */
  4.  
  5. NUMERIC DIGITS 7
  6. call addlib "LWModelerARexx.port", 0
  7. signal on error
  8. signal on syntax
  9. sysnam = 'Meters<->Inches'
  10. version = '1.0'
  11.  
  12. call req_begin sysnam
  13.  
  14. id_ft  = req_addcontrol("Feet   ", 'n')
  15. id_in  = req_addcontrol("Inches ", 'n')
  16. id_m  = req_addcontrol("Meters ", 'n')
  17.  
  18. call req_setval id_in, 0
  19. call req_setval id_ft,  0
  20. call req_setval id_m, 0
  21.  
  22. if (~req_post()) then do
  23.     call req_end
  24.     exit
  25. end
  26.  
  27. in = req_getval(id_in)
  28. ft  = req_getval(id_ft)
  29. m = req_getval(id_m)
  30.  
  31. if ft>0 then in=in+(12*ft)
  32. if in>0 then do
  33.   m=.0254*in
  34.   ft=in%12
  35.   in=in//12
  36.   st="! "
  37.   if ft>0 then st=st||strip(ft,'B','0')" Feet "
  38.   if in>0 then st=st||strip(in,'B','0')" Inches "
  39.   st = st||"= "strip(m/1,'B')" Meters"
  40.   call notify(1,st)
  41.   end
  42. else if m>0 then do
  43.   in=m/.0254
  44.   ft=in%12
  45.   in=in//12
  46.   st="! "strip(m/1,'B')" Meters = "
  47.   if ft>0 then st=st||strip(ft,'B','0')" Feet "
  48.   if in>0 then st=st||strip(in,'B','0')" Inches "
  49.   call notify(1,st)
  50.   end
  51. call req_end
  52. exit
  53.  
  54. syntax:
  55. error:
  56.   call end_all
  57.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  58.     exit
  59.